#include<bits/stdc++.h>
using namespace std;
const int maxn = 105;

struct point{
	int wz,cnt;
};

int n,a[maxn],vis[maxn];

void bfs(){
	queue<point>q;
	for(int i=a[1];i>=1;--i){
		vis[1]=1;
		if(i+1<n){
			q.push(point{i+1,1});
		}else if(i+1==n){
			cout<<"1";
			exit(0);
		}
	}
	while(!q.empty()){
		int wz=q.front().wz,cnt=q.front().cnt;
		q.pop();
		for(int i=a[wz];i>=1;--i){
			if(i+wz<n&&!vis[i+wz]){
				vis[i+wz]=1;
				q.push(point{wz+i,cnt+1});
			}else if(i+wz==n){
				cout<<cnt+1;
				exit(0);
			}
		}
	}
}

int main() {
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
	}
	bfs();
	return 0;
}

